<?php


namespace app\test\controller;


use app\utils\JwtUtils;
use firebase\jwt\JWT;
use firebase\jwt\Key;
use think\cache\driver\Redis;
use think\Controller;

class Test extends Controller
{

    public function test2(){
        var_dump(config('redis'));
        exit;
        $redis=new Redis(config('redis'));
        $redis->set("yangzl","xiaoxiao");
        var_dump($redis->get("yangzl"));
    }
    public function test(){
        $token=JwtUtils::getUserToken("2018888");
        $token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJiaW5kUm9vbVN0YXR1cyI6ZmFsc2UsInVzZXJfaWQiOiIyMDg4MTEyNjE4NDUyMjk3In0.A5fRSPvRfvbUU2VH_C2RonhhuzaxBwxPWXIAQA6MRjU";
        $res=JwtUtils::getDecodeToken($token);

        $res=json_decode(json_encode($res),true);
        var_dump($res);
//        $key = "example_key";
//        $payload = array(
//            "iss" => "http://example.org",
//            "aud" => "http://example.com",
//            "iat" => 1356999524,
//            "nbf" => 1357000000
//        );
//        $jwt = JWT::encode($payload, $key, 'HS256');
//        $decoded = JWT::decode($jwt, new Key($key, 'HS256'));
//        var_dump($jwt);
//        //var_dump(json_decode($decoded,true));
//        var_dump($decoded);
    }
}